package cn.arnold.offer.yitu;

import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); //行
        int[][] nums = new int[n][4];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 4; j++) {
                nums[i][j] = in.nextInt();
            }
        }
        int len = nums.length;
        int res = 1;
        double max = distance(nums[0], nums[1]) / (nums[1][0] - nums[0][0]);
        for (int i = 0; i < len - 1; i++) {
            double distance = distance(nums[i], nums[i + 1]);
            int timeTmp = nums[i + 1][0] - nums[i][0];
            int time = Math.abs(timeTmp);
            double speed = distance / time;
            if (speed > max) {
                max = speed;
                res = i + 1;
            }
        }
        System.out.println(res);
    }

    //3
    //2 -9 2 3
    //4 9 9 8
    //9 2 3 4
    static double distance(int[] array1, int[] array2) {
        double[] array = new double[3];
        for (int i = 1; i < array1.length; i++) {
            array[i - 1] = array2[i] - array1[i];
        }
        double x = array[0];
        double y = array[1];
        double z = array[2];
        return Math.sqrt(x * x + y * y + z * z);
    }
}
